// 引入 request 方法，假设 request 方法已经定义在某个工具文件中
import request from '/@/utils/request'; 
// 定义 API 路径枚举
enum Api {
    SysUserAdd = '/sysUser/AddUser',
    SysUserBaseInfo = '/sysUser/baseInfo',
    SysUserChangePwd = '/sysUser/changePwd',
    SysUserDelete = '/sysUser/DeleteUser',
    SysUserGrantRole = '/sysUser/grantRole',
    SysUserOwnExtOrgList = '/sysUser/ownExtOrgList?userId={userId}',
    SysUserOwnRoleList = '/sysUser/ownRoleList?userId={userId}',
    SysUserPage = '/sysUser/page',
    SysUserResetPwd = '/sysUser/resetPwd',
    SysUserSetStatus = '/sysUser/setStatus',
    SysUserUnlockLogin = '/sysUser/unlockLogin',
    SysUserUpdate = '/sysUser/UpdateUser',
    SysGrantRole = '/sysUser/GrantRole',
}

// 定义 API 方法
export const apiSysUserAddPost = (body?: any) =>
    request({
        url: Api.SysUserAdd,
        method: 'post',
        data: body,
    });

export const apiSysUserBaseInfoGet = () =>
    request({
        url: Api.SysUserBaseInfo,
        method: 'get',
    });

export const apiSysUserBaseInfoPost = (body?: any) =>
    request({
        url: Api.SysUserBaseInfo,
        method: 'post',
        data: body,
    });

export const apiSysUserChangePwdPost = (body?: any) =>
    request({
        url: Api.SysUserChangePwd,
        method: 'post',
        data: body,
    });

export const apiSysUserDeletePost = (body?: any) =>
    request({
        url: Api.SysUserDelete,
        method: 'delete',
        data: body,
    });

export const apiSysUserGrantRolePost = (body?: any) =>
    request({
        url: Api.SysUserGrantRole,
        method: 'post',
        data: body,
    });

export const apiSysUserOwnExtOrgListUserIdGet = (userId: number) =>
    request({
        url: Api.SysUserOwnExtOrgList.replace('{userId}', String(userId)),
        method: 'get',
    });

export const apiSysUserOwnRoleListUserIdGet = (userId: number) =>
    request({
        url: Api.SysUserOwnRoleList.replace('{userId}', String(userId)),
        method: 'get',
    });

    
    export const apiGrantRolePost = (body?: any) =>
        request({
            url: Api.SysGrantRole,
            method: 'post',
            data: body,
        });
export const apiSysUserPagePost = (body?: any) =>
    request({
        url: Api.SysUserPage,
        method: 'post',
        data: body,
    });

export const apiSysUserResetPwdPost = (body?: any) =>
    request({
        url: Api.SysUserResetPwd,
        method: 'post',
        data: body,
    });

export const apiSysUserSetStatusPost = (body?: any) =>
    request({
        url: Api.SysUserSetStatus,
        method: 'post',
        data: body,
    });

export const apiSysUserUnlockLoginPost = (body?: any) =>
    request({
        url: Api.SysUserUnlockLogin,
        method: 'post',
        data: body,
    });

export const apiSysUserUpdatePost = (body?: any) =>
    request({
        url: Api.SysUserUpdate,
        method: 'put',
        data: body,
    });